Conjunctive Query Answering Under Existential Rules - Decidability, Complexity, and Algorithms
نویسنده
چکیده
upper and lower joins are then defined similarly to Definition 3.7 (upper and lower join). te l-0 09 25 72 2, v er si on 1 8 Ja n 20 14 3.2. AN OPTIMAL ALGORITHM FOR GBTS 67 Definition 3.26 (Abstract upper/lower join) Let P1 and P2 be two abstract patterns, a link of P2 with P1. The abstract upper (resp. lower) join of P1 (resp. P2) w.r.t. ( ,P2) (resp. ( ,P1)), is the set of elementary abstract upper (resp. lower) joins of e1 = (sbR,⇡1) 2 P1 with e2 = (sb 2 R,⇡2), where sb 1 R and sb 2 R are subsets of body(R) for some rule R. It is denoted by Joinu(P1, ,P2) (resp. Joinl(P1, ,P2)). We now exploit this notion of join in order to define new sound creation and evolution rules. Property 22 If P ! Parent(P, ,P 0) is a sound creation rule, then P ! Parent(P, , Joinl(P, ,P 0)) is also a sound rule. Proof: Let B and B 0 be two bags of the ultimate derivation tree such that P v P(B), P 0 v P(B 0), and B 0 is a child of B by link . By soundness of join propagation, Join(P(B 0),P(B)) v P(B 0). By monotonicity of the join operation, it yields that P! Parent(P, , Joinl(P, ,P 0)) is a sound rule. ‰ Property 23 If P! Parent(P, ,P 0) is a sound creation rule, then P! Joinu(P, ,P 0) is a sound evolution rule. Proof: Similar to the proof of Prop 22. ‰ Property 24 If P! P 0 and P 0! P 00 are sound evolution rules, then P! P 00 is also a sound evolution rule. Proof: Let B a bag of the ultimate derivation tree such that P v P(B). Since P! P 0 is sound, then P 0 v P(B). Since P 0! P 00 is sound, then P 00 v P(B). Thus P! P 00 is sound. ‰ Property 25 If P!P 0 and P! Parent(P, ,P 00) are sound evolution/creation rules, then P 0! Parent(P 0, ,P 00) is a sound creation rule. Proof: It holds by monotonicity of the join operation, and by the condition that P!P 0 is sound implies that PvP 0. ‰ Property 26 If P! Parent(P, ,P 0) and P 0 ! P 00 are sound creation/evolution rules, then P! Parent(P, ,P 00) is a sound creation rule. We call pattern saturation the already outlined procedure that builds all creation and evolution rules, and that we recall here. We define as interesting the initial pattern of the initial fact. Then, we start a loop that proceeds as follows. For each interesting pattern P, we use Properties 21 and 22 to build creation rules having P as left hand side. By using Properties 23, 24, 25 and 26, we saturate the set of creation and evolution rules. We then update the set of interesting patterns by inserting any pattern that appears in a right hand side of a rule. Let us prove that this process terminates. te l-0 09 25 72 2, v er si on 1 8 Ja n 20 14 68 CHAPTER 3. MATERIALIZATION-BASED APPROACH Property 27 (Termination) For any fact F and any gbts set of rules R, pattern saturation terminates. Proof: There is a finite number of abstract patterns, and thus a finite number of evolution and creation rules. At each step, the number of created rules can only increase, which shows the termination of pattern saturation. ‰ In this fixpoint, some rules are redundant. For instance, if there exist two rules P! Parent(P, ,P 0) and P! Parent(P, ,P 00), with P 0 v P 00, then the first rule is implied by the second one. We define the set of most informative creation rules as follows: a rule P! Parent(P, ,P 0) is most informative if there is no rule P! Parent(P, ,P 00) with P 0 6=P 00 and P 0 vP 00. We define similarly the most informative evolution rules. High-level view of the algorithm Let us recall the main steps of the proposed algorithm: 1. (pattern saturation) starting from the initial pattern of the initial fact, we compute a set of evolution and creation rules that gives information on the structure of the canonical model; 2. (full blocked tree creation) from this set of evolution and creation rules, we build a full blocked tree – we detail this operation hereafter; 3. (querying step) we query the full blocked tree. If the query q is considered as a rule of the form body(q)! match, where match is a new 0-ary predicate, this step can be performed by simply checking if an element (q,⇡) with an arbitrary ⇡ belongs to one of the patterns. If we remove the query from the patterns, we have to modify this querying operation, which will be explained in the next section. Details on the full blocked tree computation We now specify how to perform the second step of the algorithm. We start from the initial abstract pattern PF associated with F. We associate it with a bag having as terms the terms of F (as well as constants appearing in rule heads). We find the most informative evolution rule having PF as left-hand side,PF ! P§ F , and apply it. That is, we modify the pattern of the root, from PF to P§ F . Then, we apply every most informative creation rule having P§ F as left member, and create corresponding bags. To apply a creation rule P! Parent(P, ,P 0), we add a child of pattern P 0 to the considered bag of pattern P, such that the induced link of that child with its parent is . We repeat this step with the newly created pattern, adding children to at most one bag of a given pattern. This procedure halts, since there is a finite number of patterns, and the arity of the built tree is also bounded. It creates a sound blocked tree, since every creation and evolution rules are sound. It also creates a full blocked tree. Indeed, we show by induction on the length of a derivation that any patterned derivation tree obtained by a derivation of length n can be generated thanks to rules that belong to the set of rules built by the pattern saturation procedure. This is trivially true for a derivation of length 0. For a derivation of length te l-0 09 25 72 2, v er si on 1 8 Ja n 20 14 3.2. AN OPTIMAL ALGORITHM FOR GBTS 69 s(b,t1),r(c,t1),q2(t1,u1,v1) q2(x2,y2,z2) q2(x4,y4,z4) s(y4,t4) s(y5,t5) r(z4,t4) r(z5,t5) r(z4,t4),s(y4,t4) Atoms of the abstract bag: r(z5,t5),s(y5,t5) t1 b c u1 v1 Figure 3.4: A graphic representation of Pb,c 1 n, let B the bag to which a child is linked at the last step. The derivation tree obtained before can be obtained by means of creation and evolution rules, by induction assumption. Property 21 ensures that a creation rule can create a child to B, and the saturation of the rule set by other properties ensures that the created bag has the good pattern. We illustrate pattern saturation by expanding the running example. Writing down absolutely every element of each pattern would impede the ease of reading. We will thus allow ourselves to skip some elements, and focus on the most important ones. Example 38 In this example, we do not consider any query (or we may assume the query to be empty). The initial pattern P0 of F contains the following elements:(q1(x1,y1,z1),⇡1(x1) = a,⇡1(y1) = b,⇡1(z1) = c), (q1(x1,y1,z1),⇡2(x1) = d,⇡2(y1) = c,⇡2(z1) = e) and (q1(x1,y1,z1),⇡1(x1) = f,⇡1(y1) = ⇡1(z1) = g). By application of Property 21, three novel rules are created: P0! Parent(P0,;,P 1 ),P0! Parent(P0,;,P 1 ) and P0 ! Parent(P0,;,P g,g 1 ), where P b,c 1 ,P c,e 1 and P g,g 1 . are described below. The abstract bag associated with Pb,c 1 has as atoms s(b,t1),r(c,t1),q2(t1,u1,v1) and an empty link (since the whole frontier of R1 is mapped to constants). The abstract bag associated with Pc,e 1 has as atoms s(c,t1),r(e,t1),q2(t1,u1,v1), and P g,g 1 has as atoms s(g,t1),r(g,t1),q2(t1,u1,v1). Pb,c 1 contains the following pairs: – ({q2(x2,y2,z2)},(⇡ 1 (x2)= t1,⇡ b,c 1 (y2)=u1,⇡ b,c 1 (z2)= v1)); – ({q2(x4,y4,z4)},(⇡ 2 (x4)= t1,⇡ b,c 2 (y4)=u1,⇡ b,c 2 (z4)= v1)); – ({s(y4,t4)},(⇡ 3 (y4)=b,⇡ b,c 3 (t4)= t1)); – ({r(z4,t4)},(⇡ 4 (z4)= c,⇡ b,c 4 (t4)= t1)); – ({s(y4,t4),r(z4,t4)},(⇡ 5 (y4)=b,⇡ b,c 5 (z4)= c,⇡ b,c 5 (t4)= t1)); – ({s(y5,t5)},(⇡ 6 (y5)=b,⇡ b,c 6 (t5)= t1)); – ({r(z5,t5)},(⇡ 7 (z5)= c,⇡ b,c 7 (t5)= t1)); – ({s(y5,t5),r(z5,t5)},(⇡ 8 (y5)=b,⇡ b,c 8 (z5)= c,⇡ b,c 8 (t5)= t1)). te l-0 09 25 72 2, v er si on 1 8 Ja n 20 14 70 CHAPTER 3. MATERIALIZATION-BASED APPROACH Pc,e 1 (resp. P g,g 1 ) contains the same pairs, except that every occurrence of b is replaced by a c (resp. a g) and every occurrence of c is replaced by a e (resp. a g). Pb,c 1 is graphically represented in Figure 38. These three patterns contain ({q2(x2,y2,z2)},(⇡ 1 (x2) = t1,⇡ b,c 1 (y2) = u1,⇡ b,c 1 (z2)= v1)), and we thus create the three following rules: – Pb,c 1 ! Parent(P b,c 1 , 1,P2), – Pc,e 1 ! Parent(P c,e 1 , 2,P2), – P 1 ! Parent(P g,g 1 , 3,P2), where 1, 2, 3 are defined by i(y2) = u1, i(z2) = v1 and P2 is defined below. . Note that we have to define three different i since the supports of Pb,c 1 ,P c,e 1 and P g,g 1 are three different abstract bags. P2 has as atoms {s(y2,t2),r(z2,t2),q3(t2,u2,v2)}. It contains the following elements: – ({q3(t3,u3,v3)},(⇡1(t3)= t2,⇡ 2 1(u3)=u2,⇡ 2 1(v3)= v2)); – ({s(y4,t4)},(⇡2(y4)=y2,⇡ 2 2(t4)= t2)); – ({r(z4,t4)},(⇡3(z4)= z2,⇡ 2 3(t4)= t2)); – ({s(y4,t4),r(z4,t4)},(⇡4(z4)= z2,⇡ 2 4(y4)=y2,⇡ 2 4(t4)= t2)); – ({s(y5,t5)},(⇡5(y5)=y2,⇡ 2 5(t5)= t2)); – ({r(z5,t5)},(⇡6(z5)= z2,⇡ 2 6(t5)= t2)); – ({s(y5,t5),r(z5,t5)},(⇡7(y5)=y2,⇡ 2 7(z5)= z2,⇡ 2 7(t5)= t2)). The element ({q3(t3,u3,v3)},(⇡1(t3) = t2,⇡ 2 1(u3) =u2,⇡ 2 1(v3) = v2)) belongs to P2, and thus, we create a rule P2! Parent(P2, 4,P3), where 3(t3) = t2 and P3 contains the following elements: – ({h(t4)},(⇡1(t4)= t2)), – ({h(t5)},(⇡2(t5)= t2)). At this point, we cannot create any new rule thanks to Property 21. However, Property 23 may be used to derive an evolution of P2. Indeed, since P2! Parent(P2, 4,P3) has been derived, we can derive that P2! P 0 2= Joinu(P2, 4,P3); P 0 2 is a superset of P2 that also contains the following elements: – ({s(y4,t4),h(t4)},(⇡1(y4)=y2,⇡ 4 1(t4)= t2)); – ({r(z4,t4),h(t4)},(⇡2(z4)= z2,⇡ 4 2(t4)= t2)); – ({s(y4,t4),r(z4,t4),h(t4)},(⇡3(z4)= z2,⇡ 4 3(y4)=y2,⇡ 4 3(t4)= t2)); – ({s(y5,t5),h(t5)},(⇡4(y5)=y2,⇡ 4 4(t5)= t2)); – ({r(z5,t5),h(t5)},(⇡5(z5)= z2,⇡ 4 5(t5)= t2)); – ({s(y5,t5),r(z5,t5),h(t5)},(⇡6(y5)=y2,⇡ 4 6(z5)= z2,⇡ 4 6(t5)= t2)); – ({h(t4)},(⇡7(t4)= t2)); – ({h(t5)},(⇡8(t5)= t2)). By Property 26, the following rules are sound: – Pb,c 1 ! Parent(P b,c 1 , 1,P 0 2); – Pc,e 1 ! Parent(P c,e 1 , 2,P 0 2); – P 1 ! Parent(P g,g 1 , 3,P 0 2). Applying once more Property 23, we get new sound rules such as: te l-0 09 25 72 2, v er si on 1 8 Ja n 20 14 3.2. AN OPTIMAL ALGORITHM FOR GBTS 71 s(b,t1),r(c,t1),q2(t1,u1,v1) q2(x2,y2,z2) q2(x4,y4,z4) s(y4,t4) s(y5,t5) r(z4,t4) r(z5,t5) r(z4,t4),s(y4,t4) Atoms of the abstract bag: r(z5,t5),s(y5,t5) q2(x2,y2,z2) q2(x4,y4,z4) s(y4,t4) s(y5,t5) r(z4,t4) r(z5,t5) r(z4,t4),s(y4,t4) r(z5,t5),s(y5,t5) s(b,t1),r(c,t1),q2(t1,u1,v1) Atoms of the abstract bag:
منابع مشابه
Conjunctive Query Answering for Directional Rules
This paper introduces Directional Rules, a new extension of Datalog with existential quantifiers in rule heads in the spirit of formalisms like tuplegenerating dependencies, Datalog+/− and ∀∃-rules that have attracted new interest recently. As opposed to known decidable classes of such existential rules, Directional Rules support complex join conditions as required for expressing transitivity. ...
متن کاملThe Impact of Disjunction on Query Answering Under Guarded-Based Existential Rules
We give the complete picture of the complexity of conjunctive query answering under (weakly-)(frontier-)guarded disjunctive existential rules, i.e., existential rules extended with disjunction, and their main subclasses, linear rules and inclusion dependencies.
متن کاملQuery Answering over Disjunctive Datalog with Existential Quantifiers
The paper discusses the impact of adding existential quantification in the head of positive disjunctive Datalog rules. After introducing syntax and semantics of the resulting language, we provide a notion of instantiation, which has been proven to be adequate for query answering purposes. Although on the one hand this new formalism is attractive for knowledge management, especially in domains w...
متن کاملAcyclic Query Answering under Guarded Disjunctive Existential Rules and Consequences to DLs
The complete picture of the complexity of conjunctive query answering under guarded disjunctive existential rules has been recently settled. However, in the case of (unions of) acyclic conjunctive queries ((U)ACQs) there are some fundamental questions which are still open. It is the precise aim of the present paper to close those questions, and to understand whether the acyclicity of the query ...
متن کاملQuery Patterns for Existential Rules
In this paper we study query answering over ontologies expressed in Datalog+/–, i.e., datalog with existential variables in rule heads. Differently from previous proposals, we focus on subclasses of unions of conjunctive queries (UCQs), rather than on the whole class of UCQs. To identify subclasses of UCQs, we introduce the notion of conjunctive query pattern. Given a class of queries Q express...
متن کاملTowards Efficient Reasoning Under Guarded-Based Disjunctive Existential Rules
The complete picture of the complexity of answering (unions of) conjunctive queries under the main guarded-based classes of disjunctive existential rules has been recently settled. It has been shown that the problem is very hard, namely 2ExpTime-complete, even for fixed sets of rules expressed in lightweight formalisms. This gives rise to the question whether its complexity can be reduced by re...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2013